<% content_for :title do %>
  <%= @event.header %>, <%= @event.content.truncate(20) %>
<% end %>

<div class="event-details">
  <div class="pure-g">
    <article class="event pure-u-1 pure-u-lg-2-3">
      <header class="event-header pure-g">
        <% if @event.cover.present? %>
          <div class="pure-u-1 pure-u-lg-3-5">
            <div class="event-cover">
              <%= image_tag @event.cover.medium.url, class: "img-responsive" %>
            </div>
          </div>
        <% end %>
        <div class="event-info pure-u-1 pure-u-lg-2-5">
          <h1 class="event-title"><%= @event.header %></h1>
          <time class="event-date">
            <i class="icon-time"></i><%= @event.start_time %>～<%= @event.end_time %>
          </time>
          <% if @event.venue.present? %>
            <p class="event-position">
              <i class="icon-position"></i>活动地点：<%= @event.venue %>
            </p>
          <% end %>
          <p class="event-slides-num"><i class="icon-book"></i>讲稿数量：<%= @event.slides.count %></p>
          <div class="event-action">
            <% if current_user == @event.creator %>
              <%= link_to "上传讲稿", slides_new_event_path, class: "btn" %>
              <%= link_to "编辑活动", edit_event_path(@event), class: "btn btn-warning" %>
            <% end %>
          </div>
        </div>
      </header>

      <section class="panel panel-for-article">
        <header class="panel-header pure-g clearfix with-hr">
          <h1 class="panel-title pure-u-1">活动内容</h1>
        </header>
      </section>

      <section class="event-content">
        <%= sanitize @event.content, scrubber: ContentScrubber.new %>
      </section>

      <section>
        <%= render partial: '/shared/disqus', locals: { object: @event } %>
      </section>
    </div>
  </div>
</div>

<section class="panel">
  <ul class="card-list pure-g">
    <%= render partial: "slides/slide_item", collection: @event.slides, as: :slide %>
  </ul>
</section>
